import javax.sound.midi.Soundbank;
import javax.swing.plaf.synth.SynthOptionPaneUI;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;

class MyCompared implements Comparator<Integer>{
    @Override
    public int compare(Integer o1, Integer o2) {
        return o1-o2;
    }
}
public class Test001 {



    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
        Set<Integer> set = new HashSet<>();
        set.add(2);
        set.add(4);
        set.add(6);
        Iterator<Integer> iterator = set.iterator();
        while(iterator.hasNext()){
            list.add((iterator.next()));
        }
        System.out.println("11111222233333333");
        System.out.println(list);

      Stream stream;
      list.stream().forEach(name-> System.out.println(name));
      List<Integer> list1 = new ArrayList<>();
      list1.add(1);
      list1.add(2);
      list1.add(3);
      list1.stream().forEach(tmp-> System.out.println(tmp));
     List<Integer> list2 =  list1.stream().map(y->y+3).collect(Collectors.toList());
        System.out.println(list2);
        System.out.println("11111122223333333:dadadadadad");
        List<Integer> list3 = new ArrayList<>();
        for(int i = 10;i>=0;i--){
            list3.add(i);
        }
        System.out.println("排序前："+list3);
        list3.sort(new MyCompared());
        System.out.println("排序后："+list3);

        System.out.println("nnnnnnnnnnnnnnnnnnnnnnn");
       List<Integer>  list4 = list3.stream().filter(a->a!=2).collect(Collectors.toList());
        System.out.println(list4);
        System.out.println("333333333333333");
        List<Integer> list5 = new ArrayList<>();
        list5.add(2);
        list5.add(2);
        list5.add(5);
        list5.add(5);
        list5.add(5);
        list5.add(3);
        System.out.println("去重前："+list5);
          List<Integer> list6 = list5.stream().distinct().collect(Collectors.toList());
        System.out.println("去重后："+list6);
    }
}
